/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx.gen;

import java.text.NumberFormat;

/**
 * <p>Project: jse2204 - MyUtil
 * <p>Powered by webrx On 2022-09-20 11:11:40
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class MyUtil<E extends Number> { //泛型类
    private E e;

    public void set(E e) {
        this.e = e;
    }

    public E get() {
        return this.e;
    }

    public E pf(E e) {
        if(e instanceof Integer){
            Integer n = Integer.parseInt(e.toString()) * Integer.parseInt(e.toString());
            return (E)n;
        }else if(e instanceof Double) {
            Double n = Double.parseDouble(e.toString()) * Double.parseDouble(e.toString());
            return (E)n;
        }
        return e;
    }

    /**
     * 泛型方法
     * @param e
     * @param <E>
     */
    public static <E extends Number> void print(E e){
        System.out.println(e);
    }

    public static <T> void show(T t){
        System.out.println(t);
    }

}
